import request from "@/util/request";

const userRole = '/userRole/'
const role = '/role/'

/*获取我的角色信息*/
export function getMyRole() {
    return request({
        method: 'get',
        url: userRole + 'getUserToRole',
    })
}

/*获取所有角色信息*/
export function getAllRoles() {
    return request({
        method: 'get',
        url: role + 'getAllRoles',
    })
}

/*更新角色*/
export function updateRole(data) {
    return request({
        method: 'put',
        url: role + 'updateRole',
        data
    })
}

export function deleteRole(roleId) {
    return request({
        method: 'delete',
        url: role + 'roleId',
    })
}

/*新增角色*/
export function addRole(data) {
    return request({
        method: 'post',
        url: role + 'addRole',
        data
    })
}

export function getRoleInfo(id) {
    return request({
        method: 'get',
        url: role + 'getRole',
        params: {
            roleId: id
        }
    })
}

export function removeRolePermission(id) {
    return request({
        method: 'delete',
        url: "/permissions/roleMenu/"+id,
    })
}

export function getModifyRoleVO(id) {
    return request({
        method: 'get',
        url: "/permissions/roleMenu/modifyRoleId/"+id,
    })
}

export function ModifyRole(data) {
    return request({
        method: 'put',
        url: "/permissions/roleMenu",
        data
    })
}
export function searchRole(dto) {
    return request({
        method: 'get',
        url: "/role/search",
        params:dto
    })
}
